﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.Globalization;

namespace Utils.Attributes
{
    public class DateFormatAttribute : ValidationAttribute
    {
        public string GreaterThan { get; set; }

        public override bool IsValid(object value)
        {
            if (value == null)
                return false;

            return (DateTime)value > DateTime.ParseExact(GreaterThan, "yyyy-MM-dd", CultureInfo.InvariantCulture);
        }
    }
}
